﻿using System;
using System.Runtime.Serialization;

namespace TMS.ProjectServiceModel
{
    public class Project : CommonObject
    {
        public Project()
        {
            LastBuildDate = DateTime.MinValue.ToUniversalTime();
            LastFromDate = DateTime.MinValue.ToUniversalTime();
            LastToDate = DateTime.MinValue.ToUniversalTime();
        }

        public int ID
        {
            get;
            set;
        }

        public string ProjectName
        {
            get;
            set;
        }

        public string ProjectTitle
        {
            get;
            set;
        }

        public string Description
        {
            get;
            set;
        }

        /// <summary>
        /// 0: waiting 1:developing 2:gdev 3:gqc 4:pre 5:prd 6:history
        /// </summary>
        public int Status
        {
            get;
            set;
        }

        public string TestEnv
        {
            get;
            set;
        }

        [DataMember(IsRequired = false, EmitDefaultValue = false)]
        public DateTime LastBuildDate
        {
            get;
            set;
        }

        public string StrLastBuildDate
        {
            get
            {
                if (LastBuildDate == DateTime.MinValue)
                {
                    return "-";
                }
                else
                {
                    return LastBuildDate.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }
        }

        public string LastBuildStatus
        {
            get;
            set;
        }

        public string LastBuildMessage
        {
            get;
            set;
        }

        [DataMember(IsRequired = false, EmitDefaultValue = false)]
        public DateTime LastFromDate
        {
            get;
            set;
        }

        [DataMember(IsRequired = false, EmitDefaultValue = true)]
        public DateTime LastToDate
        {
            get;
            set;
        }
    }
}
